jContractor: Introducing Design-by-Contract to Java Using Reflective Bytecode Instrumentation

نویسندگان

  • Murat Karaorman
  • Parker Abercrombie
چکیده

Design by Contract is a software engineering practice that allows semantic information to be added to a class or interface to precisely specify the conditions that are required for its correct operation. The basic constructs of Design by Contract are method preconditions and postconditions, and class invariants. This paper presents a detailed design and implementation overview of jContractor, a freely available tool that allows programmers to write “contracts” as standard Java methods following an intuitive naming convention. Preconditions, postconditions, and invariants can be associated with, or inherited by, any class or interface. jContractor performs on-the-fly bytecode instrumentation to detect violation of the contract specification during a program’s execution. jContractor’s bytecode engineering technique allows it to specify and check contracts even when source code is not available. jContractor is a pure Java library providing a rich set of syntactic constructs for expressing contracts without extending the Java language or runtime environment. These constructs include support for predicate logic expressions, and referencing entry values of attributes and return values of methods. Fine grain control over the level of monitoring is possible at runtime. Since contract methods are allowed to use unconstrained Java expressions, in addition to runtime verification they can perform additional runtime monitoring, logging, and analysis.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

jContractor: Bytecode Instrumentation Techniques for Implementing Design by Contract in Java

Design by Contract is a software engineering practice that allows semantic information to be added to a class or interface to precisely specify the conditions that are required for its correct operation. The basic constructs of Design by Contract are method preconditions and postconditions, and class invariants. This paper presents a detailed design and implementation overview of jContractor, a...

متن کامل

jContractor: A Reflective Java Library to Support Design by Contract

jContractor is a purely library based approach to support Design By Contract specifications such as preconditions, postconditions, class invariants, and recovery and exception handling in Java. jContractor uses an intuitive naming convention, and standard Java syntax to instrument Java classes and enforce Design By Contract constructs. The designer of a class specifies a contract by providing c...

متن کامل

Contracts for Java: A Practical Framework for Contract Programming

This report introduces Contracts for Java (Cofoja), a new framework for contract programming in Java, and the successor to Johannes Rieken’s Modern Jass. Based on the same standard Java technologies such as annotation processing and bytecode instrumentation, it improves upon the stub-based separate compilation strategy of its predecessor. Contracts for Java promotes a minimalistic yet expressiv...

متن کامل

Bytecode Instrumentation as an Aid in Understanding the Behavior of Java Persistent Stores

In this paper, we describe the use of BIT (Bytecode Instrumenting Tool) as an aid in understanding the behavior of persistent Java programs and evaluating the implementation of Java persistent stores. BIT is a set of Java classes that allow a user to build customized tools to instrument Java Virtual Machine (JVM) bytecodes. We built a customized tool using BIT to instrument Object Design Inc.’s...

متن کامل

Kava - A Reflective Java Based on Bytecode Rewriting

Current implementations of reflective Java typically either require access to source code, or require a modified Java platform. This makes them unsuitable for applying reflection to Commercial-off-theShelf (COTS) systems. The high level nature of Java bytecode makes on-the-fly rewritings of class files feasible and this has been exploited by a number of authors. However, in practice working at ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Formal Methods in System Design

دوره 27  شماره 

صفحات  -

تاریخ انتشار 2005